<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<head th:replace="admin/fragment :: head('分类新增')">
</head>

<body>

<!--导航-->
<nav th:replace="admin/fragment :: menu(2)">

</nav>

<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a th:href="@{/admin/types/add}" class="teal active item">新增</a>
            <a th:href="@{/admin/types}" class="item">列表</a>
        </div>
    </div>
</div>

<!--中间内容-->
<div class="m-container m-padded-tb-big">
    <div class="ui container">
        <form th:action="@{/admin/types/add}" method="post" class="ui form">
            <div class="required field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">名称</label>
                    <input type="text" name="name" placeholder="分类名称">
                </div>
            </div>


            <div class="ui error message"></div> <!--显示错误信息-->
            <div class="ui mini negative message" th:unless="${#strings.isEmpty(msg)}" th:text="|提示： ${msg}">提示：不能添加重复的分类</div>

            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                <button type="button" id="save-btn" class="ui secondary submit button">提交</button>
            </div>

        </form>
    </div>
</div>

<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!--底部footer-->
<footer th:replace="admin/fragment :: footer">

</footer>

<th:block th:replace="admin/fragment :: script">

</th:block>


<script>

    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
        on: 'hover'
    });

    $('.ui.form').form({
        fields: {
            title: {
                identifier: 'name',
                rules: [{
                    type: 'empty',
                    prompt: '请输入分类名称'
                }]
            }
        }
    });


</script>
</body>
</html>